package threadcoreknowledge.stopthreads;

/**
 * @ClassName RunThrowException
 * @Description run无法抛出checked Exception , 只能用try/catch
 * @Author wushaopei
 * @Date 2021/3/1 12:51
 * @Version 1.0
 */
public class RunThrowException {

    public void aVoid() throws Exception {
        throw new Exception();
    }

    public static void main(String[] args) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    throw new Exception();
                } catch (Exception e) {
                    // 保存日志、停止程序
                    System.out.println("保存日志");
                    e.printStackTrace();
                }
            }
        });
    }
}
